package com.git.contractmanagement.repository;

import com.git.contractmanagement.entity.UserFavorite;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserFavoriteRepository extends JpaRepository<UserFavorite, Integer> {
    List<UserFavorite> findByUserId(Integer userId);
    List<UserFavorite> findByUserIdAndFavoriteStatus(Integer userId, Integer favoriteStatus);
    
    @Query("SELECT uf FROM UserFavorite uf WHERE uf.userId = :userId AND uf.contractId = :contractId")
    List<UserFavorite> findByUserIdAndContractId(@Param("userId") Integer userId, @Param("contractId") Integer contractId);
}
